-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add transistor config schema file #18
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like how we are using a published package for the Carbon Platform schema to validate YAML config files. E.g.
# yaml-language-server: $schema=https://unpkg.com/@carbon-platform/schemas@v1/carbon-resources.schema.json
designKits:
carbon-white-sketch:
name: Sketch white theme
Do we want the schema to live in its own package?
Or, if we want to publish it as part of this package (e.g. @ibm/transistor-js
), what would we need to do to expose the schema as part of the top level package so an instrumented code package could use unpkg to use a versioned schema file? E.g.:
# yaml-language-server: $schema=https://unpkg.com/@ibm/transistor-js@v1/transistor-config.schema.json
collect:
npm:
dependencies:
Said differently, how could we achieve this:
https://unpkg.com/@ibm/transistor-js@v1/transistor-config.schema.json
Instead of depending on the internal directory structure:
https://unpkg.com/@ibm/transistor-js@v1/src/schemas/transistor-config.schema.json
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With top-level collect
and projectId
keys, we're dependent on the YAML file names like transistor.yml
to find and parse the config.
I'm wondering if we should nest everything inside a top-level transistor
key, e.g.:
transistor:
collect:
npm:
dependencies:
projectId: "1234"
Would this enable potential future config and indexing consolidation? Let's say the future has one ibm.yml
config to both instrument for metrics and index for website catalogs:
assets:
accordion:
name: Accordion
aspect-ratio:
name: Aspect ratio
libraries:
carbon-react:
name: Carbon React
assets:
$ref: '#/assets'
transistor:
collect:
npm:
dependencies:
projectId: "1234"
Or... if collect
and projectId
are unique and have no foreseen conflicts with Carbon Platform and InnerSource indexing... then we're good and we don't need the top level transistor
key?
Schema location/urls: Schema will eventually live in it's own package for reusability's sake since other emitters will also depend on it. The schema will be served alongside emitters' published code. How emitters consume the schema from it's standalone repository could go to ways: To make a decision between these two approaches we'll need to construct POCs and evaluate. Top level we will not depend on a we will not add a top level key at this point and can easily do so shall the time come in the future when this and other libraries and schemas are more mature. We are going to split out scopes into individual scope files and pull them in into the broader schema file by reference |
changed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some description prose cleanup.
Co-authored-by: Matt Rosno <matt.rosno@gmail.com>
Co-authored-by: Matt Rosno <matt.rosno@gmail.com>
Co-authored-by: Matt Rosno <matt.rosno@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments in Schema.ts LGTM.
Co-authored-by: Joe Harvey <51208233+jdharvey-ibm@users.noreply.github.com>
Co-authored-by: Joe Harvey <51208233+jdharvey-ibm@users.noreply.github.com>
Co-authored-by: Joe Harvey <51208233+jdharvey-ibm@users.noreply.github.com>
…tor-js into feat/schema
Co-authored-by: Joe Harvey <51208233+jdharvey-ibm@users.noreply.github.com>
Adds a schema file for transistor config with npm and jsx scope typings.
Note for @jdharvey-ibm I made some constraints here that I felt made sense like:
allowedAtrributeNames
is definedallowedAttributeStringValues
is defineChangelog
New
Testing / reviewing
test out adding and removing keys from test.yml or creating your own file
TODO: remove test.yml file